import { define , WeElement } from 'omi';

import './index.css'

const app = getApp();

define('index', class extends WeElement{
    config={
      navigationBarTitleText:"支付成功"
    }
    data = {
        image:{     // 图片
            green_click : require('../../images/green-click.png'),
        },
        pay_money:'',
        reach_time : ''
    }

    back = ()=>{
        wx.switchTab({ url: '../mine/index' });
    }

    install(option){
        // pay_money=0.01&reach_time=2019-04-11
        let { pay_money , reach_time } = option;
        this.data.pay_money = pay_money;
        this.data.reach_time = reach_time;
        this.update();
    }

    render(){
        let { pay_money , reach_time ,image } = this.data ;
        return (
            <view class='web'>
                <view class='content'>
                    <view class='green'>
                        <image src={image.green_click}></image>
                        <view>恭喜您！购买成功!</view>
                    </view>

                    <view class='payment'>
                        <view>购买金额：{pay_money}元</view>
                        <view>到店时间：{reach_time}</view>
                        <view>已付金额：<label class='orange'> {pay_money}元</label></view>
                    </view>
                </view>

                <view class='bottom_bar'>
                    <view class='back' bindtap='back' >立即返回</view>
                </view>
            </view>
        )
    }
})